{{template "admin/top.html" .}}
<div class="m-b-md"> <h3 class="m-b-none">Email Configuration</h3></div>

<div class="row">

<div class="col-sm-6">
	<form id="add_user_form">
		<section class="panel panel-default">
			<div class="panel-body">
				<div class="form-group">
					<label>Host</label>
					<input type="text" class="form-control" name="emailHost" value="{{.str.emailHost}}" placeholder="eg. smtp.ym.163.com">
				</div>
				<div class="form-group">
					<label>Port</label>
					<input type="text" class="form-control" name="emailPort" value="{{.str.emailPort}}" placeholder="eg. 25">
				</div>
				<div class="form-group">
					<label>Username</label>
					<input type="text" class="form-control" name="emailUsername" value="{{.str.emailUsername}}" placeholder="">
				</div>
				
				<div class="form-group">
					<label>Password</label>
					<input type="text" class="form-control" name="emailPassword" value="{{.str.emailPassword}}" placeholder="">
				</div>
				<div class="form-group">
					<label>SSL ?</label>
					<input type="checkbox" class="form-control" name="emailSSL" {{if .str.emailSSL}}checked="checked"{{end}} value="1">
				</div>
			</div>
			
			<footer class="panel-footer text-right bg-light lter">
				<button type="submit" id="submit" class="btn btn-success btn-s-xs">Submit</button>
			</footer>
		</section>
	</form>
</div>

</div>

{{template "admin/footer.html" .}}
<script src="/public/admin/js/jquery-validation-1.13.0/jquery.validate.js"></script>
<script>
$(function() {
	init_validator("#add_user_form");
	
	$("#submit").click(function(e){
			e.preventDefault();
			var t = this;
			if($("#add_user_form").valid()) {
				$(t).button('loading');
				ajaxPost("/adminEmail/set", getFormJsonData("add_user_form"), function(ret){
					$(t).button('reset')
					if(!ret.Ok) {
						art.alert(ret.Msg)
					} else {
						art.tips("Success");
					}
				});
			}
		});
});
</script>

{{template "admin/end.html" .}}